<%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2020/9/14
  Time: 10:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="/util/jquery-3.5.0.min.js"></script>
</head>
<style>
    .queer{
        position: absolute;
        top: 30px;
        left: 20px;
        width: 120px;
    }
    .dextro{
        position: absolute;
        top: 20px;
        left: 200px;
    }
</style>
</head>
<body>
<div class="queer">
    <div>
        <img src="/imgs/u=3889675942,1175940180&fm=26&gp=0.png" width="120">
    </div>
    <div>
        <table>
            <tr>
                <td>房间号码</td>
                <td>${hotelreservation.commodityid}</td>
            </tr>
            <tr>
                <td>房间的类型</td>
                <td>${hotelreservation.merchandise}</td>
            </tr>
            <tr>
                <td>房间内容</td>
                <td>${hotelreservation.house}</td>
            </tr>
            <tr>
                <td>房间价格</td>
                <td>${hotelreservation.person}</td>
            </tr>

        </table>
    </div >
    <div class="dextro">
        <form >
            <h2>预定信息</h2>
            入住时间 <input type="datetime-local" id="Startingtime"> 离店时间<input type="datetime-local" id="timeofdepartrueDate">
            用户名<input  type="text" id="reservername"><br>
            电话<input type="text" id="phone"><br>
            身份证号<input type="text" id=" identificationcard"><br>
            留言<textarea id="messags"></textarea>
            <h2 style="color: red">预定必须去前台交300元押金</h2>
            <button type="button" onclick="chia(${hotelreservation.commodityid})"></button>
        </form>
       <div id="successful">

       </div>
    </div>
</div>
<script type="text/javascript">
    function chia(commodity) {
     var Startingtime=$.trim($("#Startingtime").val());
     var  timeofdepartrueDate=$.trim($("#timeofdepartrueDate").val());
     var  reservername=$.trim($("#reservername").val());
     var phone=$.trim($("#phone").val());
     var identificationcard=$.trim($("#identification").val());
     var messags=$.trim($("#messags").val());
     var data={
         Startingtime:Startingtime,
         timeofdepartrueDate:timeofdepartrueDate,
         reservername:reservername,
         phone:phone,
         identificationcard:identificationcard,
         messags:messags,
         reservecommodity:commodity
     }
     $.ajax({
         type:'POST',
         url:'/status/scheduled',
         data:data,
         dataType:'josn',
         success:function (data) {
         if (data!=0){
             document.getElementById("successful").innerText=data;
         }else {
             alert("重新输入")
         }
         }
     })
    }
</script>
</body>
</html>